<template>
  <div class="label-top">
    <el-form ref="form" :model="form" :rules="rules"  label-position="top" label-width="120px">
      <el-row :gutter="15">
        <el-col :span="12">
          <el-form-item label="单位名称" prop="cName">
            <el-input v-model="form.cName" disabled placeholder="请输入单位名称"/>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="行业" prop="cIndustry">
            <el-select v-model="form.cIndustry" placeholder="请选择行业">
              <el-option
                v-for="dict in dict.type.product_industry"
                :key="dict.value"
                :label="dict.label"
                :value="dict.value"
              />
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="应用场景" prop="cScene">
            <el-input v-model="form.cScene" placeholder="请输入应用场景"/>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="人员规模" prop="cScale">
            <el-select v-model="form.cScale" placeholder="请选择人员规模">
              <el-option
                v-for="dict in dict.type.personnel_size"
                :key="dict.value"
                :label="dict.label"
                :value="dict.value"
              />
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="适配OS" prop="cOs">
            <el-select v-model="form.cOs" placeholder="请选择适配OS">
              <el-option
                v-for="dict in dict.type.audition_os"
                :key="dict.value"
                :label="dict.label"
                :value="dict.value"
              />
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="适配平台" prop="cPlatform">
            <el-input v-model="form.cPlatform" placeholder="请输入适配平台"/>
          </el-form-item>
        </el-col>
        <el-col :span="12">

          <el-form-item label="建设内容">
            <el-input type="textare" v-model="form.cContent"  />
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="使用评价" prop="cEvaluate">
            <el-input v-model="form.cEvaluate" placeholder="请输入使用评价"/>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="应用系统名称" prop="cAppName">
            <el-input v-model="form.cAppName" placeholder="请输入应用系统名称"/>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="竣工日期" prop="cCompletionDate">
            <el-date-picker clearable
                            v-model="form.cCompletionDate"
                            type="date"
                            value-format="yyyy-MM-dd"
                            placeholder="请选择竣工日期">
            </el-date-picker>
<!--            <el-input v-model="form.cCompletionDate" placeholder="请输入竣工日期"/>-->
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="建设周期" prop="cConstructionCycle">
            <el-input v-model="form.cConstructionCycle" placeholder="请输入建设周期"/>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="硬件产品清单" prop="cHardwareInventory">
            <el-input type="textarea" v-model="form.cHardwareInventory" placeholder="请输入硬件产品清单"/>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="软件产品清单" prop="cSoftwareInventory">
            <el-input type="textarea" v-model="form.cSoftwareInventory" placeholder="请输入软件产品清单"/>
          </el-form-item>
        </el-col>
        <el-col :span="12">



          <el-form-item label="附件" prop="cAttachment">
            <file-upload v-model="form.cAttachment" placeholder="请输入附件"/>
          </el-form-item>


        </el-col>
      </el-row>
    </el-form>
    <div slot="footer" class="dialog-footer">
      <el-button type="primary" @click="submitForm">确 定</el-button>
      <el-button @click="cancel">取 消</el-button>
    </div>
  </div>
</template>

<script>
import AddMixin from "@/minixs/add"
import request from "@/utils/request";

export default {
  name: "add",
  mixins: [AddMixin],
  dicts: ['product_industry', 'audition_os','personnel_size'],
  data() {
    return {
      // 表单数据
      form: {
        id: null,
        cName: "单位一",
        cIndustry: null,
        cScene: null,
        cScale: null,
        cOs: null,
        cPlatform: null,
        cContent: null,
        cEvaluate: null,
        cAppName: null,
        cCompletionDate: null,
        cConstructionCycle: null,
        cHardwareInventory: null,
        cSoftwareInventory: null,
        cAttachment: null,
        cState: null,
        delFlag: null,
        createBy: null,
        updateBy: null,
        createTime: null,
        updateTime: null,
        remark: null
      },
      // 表单校验
      rules: {
        cName: [
          {required: true, message: "单位名称不能为空", trigger: "blur"}
        ],
        cIndustry: [
          {required: true, message: "行业不能为空", trigger: "blur"}
        ],
        cScene: [
          {required: true, message: "应用场景不能为空", trigger: "blur"}
        ],
        cScale: [
          {required: true, message: "人员规模不能为空", trigger: "blur"}
        ],
        cOs: [
          {required: true, message: "适配OS不能为空", trigger: "blur"}
        ],
        cPlatform: [
          {required: true, message: "适配平台不能为空", trigger: "blur"}
        ],
        cContent: [
          {required: true, message: "建设内容不能为空", trigger: "blur"}
        ],
        cEvaluate: [
          {required: true, message: "使用评价不能为空", trigger: "blur"}
        ],
        cAppName: [
          {required: true, message: "应用系统名称不能为空", trigger: "blur"}
        ],
        cCompletionDate: [
          {required: true, message: "竣工日期不能为空", trigger: "blur"}
        ],
        cConstructionCycle: [
          {required: true, message: "建设周期不能为空", trigger: "blur"}
        ],
        cHardwareInventory: [
          {required: true, message: "硬件产品清单不能为空", trigger: "blur"}
        ],
        cSoftwareInventory: [
          {required: true, message: "软件产品清单不能为空", trigger: "blur"}
        ],
        cAttachment: [
          {required: true, message: "附件不能为空", trigger: "blur"}
        ],
        cState: [
          {required: true, message: "审核状态0:待审核 2:不合格 3:正常不能为空", trigger: "blur"}
        ],
      }
    }
  },
  methods: {
    // 保存数据
    save() {
      request({
        url: '/info/caseInfo',
        method: 'post',
        data: this.form
      }).then(response => {
        this.$modal.msgSuccess("新增成功");
        this.$emit("reload")
        this.cancel();
      });
    },
  }
};
</script>
